#!/bin/bash

#用来进行测试某个网络服务是不是打开; 

service_name=""; 
testing=""; 
while [ "$service_name" != "q" ]
do
	read -p "Please input your net service, enter q to quit:" service_name ;
	if [ ! "$service_name" != "q" ];
	then
		echo "thank you for your uage"; 
		exit 0; 
	fi
	testing=$(netstat -tunl | grep ":$service_name")
	if  [ "$testing" != "" ]; 
	then
		echo "the service %s is open, $service_name"; 
	else
		echo "the service $s is not open, $service_name"; 
	fi
done


